/**
 * Project Name:lee
 * File Name:UserServiceImpl.java
 * Package Name:com.lee.service.impl.system
 * Date:2016年12月9日上午9:44:57
 * Copyright (c) 2016, chenzhou1025@126.com All Rights Reserved.
 *
 */

package com.lee.system.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.lee.system.mapper.ResourcesInfoMapper;
import com.lee.system.model.ResourcesInfo;
import com.lee.system.service.ResourcesService;

/**
 * ClassName:UserServiceImpl <br/>
 * Function: TODO ADD FUNCTION. <br/>
 * Reason: TODO ADD REASON. <br/>
 * Date: 2016年12月9日 上午9:44:57 <br/>
 * 
 * @author dell
 * @version
 * @since JDK 1.6
 * @see
 */
@Transactional
@Service
public class ResourcesServiceImpl implements ResourcesService {
	@Autowired
	private ResourcesInfoMapper resouresInfoMapper;
	
	@Override
	public int count(ResourcesInfo t) {
		return resouresInfoMapper.count(t);
	}

	@Override
	public int insert(ResourcesInfo t) {
		
		return resouresInfoMapper.insert(t);
	}

	@Override
	public int update(ResourcesInfo t) {
		
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int delete(int id,boolean flag) {
		int i = 0;
		if(flag){
			i = resouresInfoMapper.delete(id);
		}
		resouresInfoMapper.deleteAttr(id);
		return i;
	}

	@Override
	public ResourcesInfo findById(int id) {
		
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<ResourcesInfo> findByPid(int id) {
		
		// TODO Auto-generated method stub
		return null;
	}
	/**
	 * 
	 * TODO 查询用户的权限
	 * @see com.lee.system.service.ResourcesService#findRes(java.util.Map)
	 */
	@Override
	public List<ResourcesInfo> findRes(Map<String, Object> map) {
		List<ResourcesInfo> list = resouresInfoMapper.findRes(map);
		return list;
	}
	//分页查询所以的菜单（sql中type=1）
	@Override
	public List<ResourcesInfo> findByPage(Map<String, Object> map) {
		List<ResourcesInfo> list = resouresInfoMapper.findByPage(map);
		return list;
	}
	/**
	 * 
	 * TODO 查询所有的资源.
	 * @see com.lee.system.service.ResourcesService#findAll(java.util.Map)
	 */
	@Override
	public List<ResourcesInfo> findAll(Map<String, Object> map) {
		return resouresInfoMapper.findAll(map);
	}

}
